<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<div class="aui-fullpage">
    <div class="aui-header-1">
        <lv-group lvGutter="8px">
            <i lv-icon="aui-widget-datepicker-previous" [lvColorState]="true" (click)="gotoDetail()"></i>
            <h1>{{ 'common_execute_result_label' | i18n }}</h1>
        </lv-group>
    </div>
    <div class="aui-block">
        <div class="summary aui-gutter-column-lg">
            <h2 class="aui-gutter-column-md">{{'common_summary_label' | i18n}}</h2>
            <lv-group [lvColumns]='["12%", "12%", "12%", "auto"]' class="summary-group">
                <lv-group lvDirection='vertical' lvGutter='8px'>
                    <span class="aui-text-label">{{'insight_job_status_label' | i18n}}</span>
                    <div>
                        <aui-status [value]="exerciseJob?.status" type="Job_status"></aui-status>
                    </div>
                </lv-group>
                <lv-group lvDirection='vertical' lvGutter='8px'>
                    <span class="aui-text-label">{{'explore_drill_recovery_time_label' | i18n}}</span>
                    <span>
                        <ng-container
                            *ngIf="!checkInProgress(exerciseJob) && _isNumber(exerciseJob?.endTime - exerciseJob?.startTime); else elseTemplate">
                            {{appUtilsService.getDuration(exerciseJob?.endTime - exerciseJob?.startTime)}}
                        </ng-container>
                    </span>
                </lv-group>
                <lv-group lvDirection='vertical' lvGutter='8px'>
                    <span class="aui-text-label">{{'explore_drill_id_label' | i18n}}</span>
                    <span lv-overflow>{{exerciseId | nil}}</span>
                </lv-group>
                <span class="aui-link report-btn" (click)="exportJob()">
                    {{'common_download_label' | i18n}}
                </span>
            </lv-group>
        </div>
        <div class="sub-task">
            <h2 class="aui-gutter-column-md">{{'explore_drill_sub_task_label' | i18n}}</h2>
            <lv-pro-table #dataTable [config]="dataTableConfig" [data]="dataTableData"></lv-pro-table>
        </div>
    </div>
</div>

<ng-template #elseTemplate>
    --
</ng-template>

<ng-template #startTimeTpl let-item>
    <span lv-overflow>
        {{item.startTime | date: 'yyyy-MM-dd HH:mm:ss':timeZone | nil}}
    </span>
</ng-template>

<ng-template #resourceType let-item>
    <span lv-overflow>{{getResourceType(item) | nil}}</span>
</ng-template>